﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_IPORT.Master" CodeBehind="User_IPORT.aspx.vb" Inherits="I_PORT.User_IPORT" 
    title="IRPC INTELLIGENT PORT SERVICE" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" language="javascript">
                var _source;
    // keep track of the popup div
    var _popup;

    function showConfirm(customerid) {
        this._source = customerid;
        this._popup = $find('ModalPopupExtender3'); 
        this._popup.show();  
    }
       function okClick(){
        //  find the confirm ModalPopup and hide it
       this._popup.hide();

        __doPostBack(this._source.name,'');
        
    }
    
    function cancelClick(){
        //  find the confirm ModalPopup and hide it
        this._popup.hide();
    }
        function closeModal() {
           document.getElementById('ctl00_contentplaceholder1_framePopup').src = '../MasterPopup/User_Popup.aspx';
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender1');
            mpu.hide();
            document.getElementById('ctl00_ContentPlaceHolder1_btnHide').click();
        }
        function showPopup() {
             document.getElementById('ctl00_contentplaceholder1_framePopup').contentWindow.location.reload(true);
        }
</script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
   <table width="100%" border="0" cellpadding="2" cellspacing="0" >
        <tr>
             <td style="width:20%;" align="right"><asp:Label ID="lbName" runat="server" SkinID="lbtxt" Text="Username/Name :"></asp:Label>&nbsp;</td>
             <td align="left"><asp:TextBox ID="txtName" runat="server"></asp:TextBox>
             </td>
        </tr>
         <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label1" runat="server" SkinID="lbtxt" Text="Role :"></asp:Label>&nbsp;</td>
             <td align="left"><asp:DropDownList ID="ddlRole" runat="server" SkinID="ddl" >
             </asp:DropDownList>
                <asp:Button ID="btnSearch" runat="server" Text="ค้นหา" CssClass="ButtonStyle" />
             </td>
        </tr>
        <tr>
           <td style="height:5px;"><img src="../Image/space.gif" /></td>
        </tr>
       <tr>
         <td colspan="2" align="center">
          <asp:GridView ID="gridItem" runat="server" SkinID="gridblue" DataKeyNames="User_name,Status,Email,Password,Customer_no,Customer_name"
                     AutoGenerateColumns="False">
                     <PagerTemplate>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <asp:ImageButton ID="ImgFirst" runat="server" Height="22px" ImageUrl="../Image/arrow-first.gif"
                                                            OnCommand="Paginate" CommandArgument="First" CommandName="Page" />
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="ImgBack" runat="server" Height="22px" ImageUrl="../Image/arrow-back.gif"
                                                            OnCommand="Paginate" CommandArgument="Prev" CommandName="Page" />
                                                    </td>
                                                    <td valign="top">
                                                        Page
                                                        <asp:DropDownList ID="ddlPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPage_SelectedIndexChanged">
                                                        </asp:DropDownList>
                                                        of
                                                        <asp:Label ID="lbPageCount" runat="server" Text="Label"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="ImgNext" runat="server" Height="22px" ImageUrl="../Image/arrow-next.gif"
                                                            OnCommand="Paginate" CommandArgument="Next" CommandName="Page" />
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="ImgEnd" runat="server" Height="22px" ImageUrl="../Image/arrow-end.gif"
                                                            OnCommand="Paginate" CommandArgument="Last" CommandName="Page" />
                                                    </td>
                                                </tr>
                                            </table>
                      </PagerTemplate>
                     <Columns>
                         <asp:BoundField HeaderText="Name" DataField="Name" />
                         <asp:BoundField HeaderText="Role" DataField="RoleName" />
                         <asp:BoundField HeaderText="Status" />
                         <asp:TemplateField HeaderText="แก้ไข" ItemStyle-Width="50px">
                             <ItemTemplate>
                                 <asp:ImageButton ID="imgedit" CommandName="cmdedit" CommandArgument="<%# Container.DataItemIndex %>"  runat="server" ImageUrl="~/Image/edit-24.gif" />
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px">
                            <ItemTemplate>
                                 <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick="showConfirm(this); return false;"  runat="server" ImageUrl="~/Image/cancel-24.gif" />
                             </ItemTemplate>
                         </asp:TemplateField>
                     </Columns>
             </asp:GridView>
         </td>
      </tr>
      <tr>
         <td style="width:5%;" align="right">&nbsp;</td>
          <td align="left"><asp:Button ID="btnAdd" runat="server" CssClass="ButtonStyle" Text="New User" OnClientClick="showPopup();" /><asp:Button ID="btnHide" runat="server" style="display:none;" Text=""  /></td>
      </tr>
   </table>
     <asp:Button ID="BtnTrigger" runat="server" style="display:none;" />
     <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="Background"
     TargetControlID="btnAdd" PopupControlID="PopupAdd" >
    </asp:ModalPopupExtender>
        <asp:ModalPopupExtender BehaviorID="ModalPopupExtender3" runat="server" 
                                    OkControlID="ctl00_contentplaceholder1_ConfirmDelete_btnOk" 
                                    OnOkScript="okClick();" 
                                    CancelControlID="ctl00_contentplaceholder1_ConfirmDelete_btnNo"     
                                    OnCancelScript="cancelClick();" 
                                     BackgroundCssClass="Background" DropShadow="false" 
                                      PopupControlID="PanelConfirm" TargetControlID="BtnTrigger" >
        </asp:ModalPopupExtender>
       <asp:Panel ID="PopupAdd" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="framePopup" class="Style-Iframe" marginheight="0px" marginwidth="0px" src="../MasterPopup/User_Popup.aspx">
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="PanelConfirm" runat="server" style="display:none;">
       <Confirm:Confirm1 ID="ConfirmDelete" runat="server" ></Confirm:Confirm1>
    </asp:Panel>
       </ContentTemplate>
    </asp:UpdatePanel>
<%--   <script type="text/javascript"> 
//SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
tabdropdown.init("colortab", 2)
</script>--%>
</asp:Content>
